/*
 *	This file is part of Lounge-Cast.
 *
 *  Author:  	Markus Moormann
 *	E-mail:  	mmoorman@uni-osnabrueck.de
 *	Copyright:	University of Osnabrueck (Zentrum Virtuos)
 * 	Website:	www.uni-osnabrueck.de
 *	Date:		16.02.2011
 *
 *	Lounge-Cast is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *	Lounge-Cast is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Lounge-Cast.  If not, see <http://www.gnu.org/licenses/>.
 */
package multimedia.model.vo
{

	/**
	 * class representing a text
	 */
	[Bindable]
	[RemoteClass(alias="backend.vo.TextVO")]
	public class TextVO extends MediaVO
	{

		/**
		 * static value for left image/video orientation
		 */
		public static const LEFT:String = "left";
		/**
		 * static value for right image orientation
		 */
		public static const RIGHT:String = "right";
		/**
		 * static value for top image orientation
		 */
		public static const TOP:String = "top";
		/**
		 * static value for bottom image orientation
		 */
		public static const BOTTOM:String = "bottom";

		/**
		 * the text of the media
		 */
		public var text:String;
		/**
		 * the formated text of the media containing HTML tags
		 */
		public var formated_text:String;
		/**
		 * the background color of the media
		 */
		public var background_color:uint;
		/**
		 * the skin of the media(not yet ready)
		 */
		public var skin:String;
		/**
		 * the image to be shown
		 */
		public var image:ImageVO;
		/**
		 * the video to be shown
		 */
		public var video:VideoVO;
		/**
		 * the orientation of the image
		 * one of the static values (LEFT|RIGHT|TOP|BOTTOM)
		 */
		public var image_orientation:String
		/**
		 * the background image to show
		 */
		public var background_image:String;
		/**
		 * margin from bottom
		 */
		public var margin_bottom:Number;
		/**
		 * margin from left
		 */
		public var margin_left:Number;
		/**
		 * margin from top
		 */
		public var margin_top:Number;
		/**
		 * margin from right
		 */
		public var margin_right:Number;
		
		/**
		 * publish date of feed_item
		 */
		public var publish_date:Date;

		/**
		 * default constructor
		 */
		public function TextVO()
		{
		}
		;

		/**
		 * method to get an instance of TextVO
		 *
		 * @param media the media containing all common information
		 * @param text the unformated text of the media
		 * @param formated_text the formated text of the media containing HTML tags
		 * @param background_color the color of the background
		 * @param skin the skin to show
		 * @param image the image to show
		 * @param video the video to show
		 * @param image_orientation the orientation of the image one of the static values (LEFT|RIGHT|TOP|BOTTOM)
		 *
		 * @return an instance of TextVO containing the given data
		 */
		public static function getInstance(media:MediaVO,
											text:String,
											formated_text:String,
											background_color:uint,
											skin:String,
											image:ImageVO,
											video:VideoVO,
											image_orientation:String,
											background_image:String,
											margin_bottom:Number,
											margin_left:Number,
											margin_top:Number,
											margin_right:Number):TextVO
		{
			var textvo:TextVO = new TextVO();
			textvo.media_id = media.media_id;
			textvo.added = media.added;
			textvo.addedBy = media.addedBy;
			textvo.approved = media.approved;
			textvo.converted = media.converted;
			textvo.duration = media.duration;
			textvo.newsticker = media.newsticker;
			textvo.playlist_id = media.playlist_id;
			textvo.position = media.position;
			textvo.reference = media.reference;
			textvo.title = media.title;
			textvo.type = media.type;
			textvo.start_date = media.start_date;
			textvo.valid_date = media.valid_date;
			textvo.category = media.category;
			textvo.hide_title = media.hide_title;
			textvo.title_color = media.title_color;

			textvo.text = text;
			textvo.formated_text = formated_text;
			textvo.background_color = background_color;
			textvo.skin = skin;
			textvo.image = image;
			textvo.video = video;
			textvo.image_orientation = image_orientation;
			textvo.background_image = background_image;
			textvo.margin_bottom = margin_bottom;
			textvo.margin_left = margin_left;
			textvo.margin_top = margin_top;
			textvo.margin_right = margin_right;

			return textvo;
		}

	}
}